package org.czl.leetCode3;

public class l2419 {
    public static void main(String[] args) {
        longestSubarray(new int[]{323376, 323376, 323376, 323376, 323376, 323376, 323376, 75940, 323376, 323377, 323377});
    }
    public static int longestSubarray(int[] nums) {
        int ans = 1;
        int cnt = 1;
        int max = Integer.MIN_VALUE;
        for(int i : nums){
            if(i > max){
                max = i;
                ans = 1;
            }else if(i == max){
                cnt++;
                ans = Math.max(cnt, ans);
            }else{
                cnt = 1;
            }
        }
        return ans;
    }
}
